package com.codefish.codefishseckill.utils;

import com.codefish.codefishseckill.entity.AuthUser;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * @author <a href='https://gitee.com/hzf2281'>codefish</a>
 * @version 1.0.0
 * @since 2022/08/31 下午 03:19
 */
public class SecurityUtils {

    public static AuthUser getLocalUser(){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        AuthUser authUser = (AuthUser) authentication.getPrincipal();
        return  authUser;
    }
}
